import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ItemList extends StatelessWidget {
  final String label;
  final String? value;
  final String? desc;
  final Widget? rightWidget;
  final double? height;
  final double? labelSize;
  final VoidCallback? onTap;
  final TextStyle? textStyle;
  final EdgeInsetsGeometry? padding;
  final Widget? icon;
  final double? allSpace;
  const ItemList({
    super.key,
    this.height,
    this.labelSize,
    required this.label,
    this.value,
    this.desc,
    this.rightWidget,
    this.onTap,
    this.textStyle,
    this.padding,
    this.icon,
    this.allSpace = 15
  });

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: (){
        if(rightWidget != null) {
          return;
        }
        onTap?.call();
      },
      child: Container(
        color: Colors.transparent,
        height: height ?? 50,
        padding: padding ?? EdgeInsets.symmetric(horizontal: 20),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [

            if(desc != '' && desc != null)
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(label, style: TextStyle(fontSize: labelSize ?? 15,fontWeight: FontWeight.w400)),
                  const SizedBox(height: 8,),
                  Text(desc ?? '', style: TextStyle(fontSize: 8,color: Colors.white.withOpacity(0.5), fontWeight: FontWeight.w400)),
                ],
              ),
            if(desc == '' || desc == null)
              Row(children: [
                if(icon != null)
                  icon!,
                SizedBox(width: allSpace,),
                Text(label, style: textStyle ?? TextStyle(fontSize: labelSize ?? 15,fontWeight: FontWeight.w400)),
              ],),
            if(rightWidget != null)
              rightWidget ?? const SizedBox.shrink(),
            if(rightWidget == null)
              Row(
                children: [
                  Text(value ??'', style: const TextStyle(fontSize: 15,fontWeight: FontWeight.bold)),
                   Icon(
                    Icons.chevron_right,
                    size: 16.w,
                     color: const Color(0xFFB8B8B8),
                  )
                ],
              ),
          ],
        ),
      ),
    );
  }
}
